package string;

public class CharAtDemo {
    public static void main(String[] args) {
        String str = "www.tedu.com";
        char c = str.charAt(4);
        System.out.println(c);
        for (int i = 0; i < str.length(); i++) {
            System.out.print(str.charAt(i));
        }
        System.out.println();
        String line = "上海自来水来自海上";
//        String line1 = "";
//        for (int i = line.length() - 1; i >= 0; i--) {
//            System.out.println(line.charAt(i));
//            line1 = line1 + line.charAt(i);
//        }
//        System.out.println(line1);
//        System.out.println(line == line1);
        for (int i = 0; i < line.length() / 2; i++) {
            if (line.charAt(i) != line.charAt(line.length() - i - 1)) {
                System.out.println("不是回文");
                break;
            }
        }
    }
}
